//
//  WQCalendarTileView.m
//  iBaby365v2
//
//  Created by Kirinrin on 14-7-25.
//  Copyright (c) 2014年 suplus. All rights reserved.
//

#import "WQCalendarTileView.h"

@interface WQCalendarTileView()
@property (strong, nonatomic)UIImageView *checkInImageView;
@property (strong, nonatomic)UIImageView *checkOutImageView;
@end

@implementation WQCalendarTileView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
    }
    return self;
}


// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    
    
    if (_day) {
        _dayLable = [[UILabel alloc]initWithFrame:CGRectMake(3, 3, 20, 10)];
        [_dayLable setFont:[UIFont fontWithName:@"HelveticaNeue" size:12]];
        
        if (_isWeekEnd) {
            if (_isCurrentMonthDay) {
                _dayLable.textColor = RGBACOLOR(240, 0, 0, 0.8);
            }else{
                _dayLable.textColor = RGBACOLOR(240, 0, 0, 0.4);
            }
        }else{
            if (_isCurrentMonthDay) {
                _dayLable.textColor = RGBACOLOR(40, 40, 40, 0.8);
            }else{
                _dayLable.textColor = RGBACOLOR(40, 40, 40, 0.4);
            }
        }
        [_dayLable setText:_day];
        [self addSubview:_dayLable];
    }
    
    if (_isShowCheckInImage) {
        _checkInImageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"入园半圆"]];
        CGRect frame = CGRectMake(13, 16, 9, 18);
        _checkInImageView.frame = frame;
        [self addSubview:_checkInImageView];
    }
    if (_isShowCheckOutImage) {
        _checkOutImageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"离园半圆"]];
        CGRect frame = CGRectMake(23, 16, 9, 18);
        _checkOutImageView.frame = frame;
        [self addSubview:_checkOutImageView];
    }
}


-(void)setSelected:(BOOL)selected{
    if (selected) {
        self.backgroundColor = RGBACOLOR(254, 238, 221, 0.8);
    }else{
        self.backgroundColor = [UIColor whiteColor];
    }
}
@end
